.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 110px);
  background: #ffffff;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.message-container {
  padding: 18px 12px;
  box-sizing: border-box;
  width: 100%;
}

.chat-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0px 8px 8px 8px;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  height: 100px;
  flex-shrink: 0;
}

.footer-input-group {
  width: 100%;
  position: relative;
}

.footer-input-group-inner {
  width: 100%;
  display: flex;
  align-items: stretch;
}

.footer-input {
  flex: 1;
  border-radius: 18px 0 0 18px;
  background: #fff;
  font-size: 1em;
  min-height: 40px;
  border: 1.5px solid #d0d7de;
  box-shadow: none;
  color: #222;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.footer-input:focus-within {
  border-color: #16baaa;
  box-shadow: 0 0 0 2px #16baaa22;
}
.footer-input ::placeholder {
  color: #bdbdbd;
  opacity: 1;
}

.footer-btn {
  min-width: 80px;
  height: auto;
  border-radius: 0 18px 18px 0;
  font-size: 1em;
  margin-left: 0;
  align-self: stretch;
  border-left: none;
  box-shadow: none;
}

.message-row {
  display: flex;
  align-items: flex-end;
}

.message-row.user {
  justify-content: flex-end;
  width: 100%;
  margin-right: 0;
}

.message-row.ai {
  justify-content: flex-start;
}

.message {
  max-width: 85%;
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 1em;
  line-height: 1.5;
  word-break: break-all;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.message.user {
  background: #d2f4ea;
  color: #0a5d36;
  border-bottom-right-radius: 4px;
  box-shadow: none !important;
  max-width: 70%;
  margin-left: auto;
  margin-right: 0;
}

.message.ai {
  background: #e6f7ff;
  color: #0958d9;
  border-bottom-left-radius: 4px;
  border-radius: 18px;
  max-width: 85%;
  padding: 10px 24px 10px 32px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  font-size: 1em;
  line-height: 1.5;
  margin-left: 0;
  margin-right: auto;
}

.ai-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 2px;
}

.ai-model-name-outer {
  color: #0958d9;
  font-weight: bold;
  font-size: 1.08em;
  margin-bottom: 2px;
  margin-left: 12px;
  margin-top: 2px;
  text-align: left;
  letter-spacing: 0.5px;
}

.ai-thinking {
  color: #888;
  font-style: italic;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-thinking::before {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid #16baaa;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ai-markdown {
  padding-left: 12px;
  background: none;
  box-shadow: none;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* 代码块样式，兼容 highlight.js 主题 */
.ai-markdown :deep(pre) {
  border: 1px solid #444;
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  margin: 8px 0;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre;
}
.ai-markdown :deep(code) {
  border-radius: 3px;
  padding: 2px 4px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 85%;
}

.ai-markdown :deep(pre code) {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* 行内代码样式 */
.ai-markdown :deep(p code) {
  background: #f6f8fa;
  border-radius: 3px;
  padding: 2px 4px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 85%;
}

/* markdown表格样式优化 */
.ai-markdown :deep(table) {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  background: #fff;
  font-size: 1em;
}
.ai-markdown :deep(th),
.ai-markdown :deep(td) {
  border: 1px solid #e1e4e8;
  padding: 8px 12px;
  text-align: left;
}
.ai-markdown :deep(th) {
  background: #f6f8fa;
  font-weight: bold;
}
.ai-markdown :deep(tr:nth-child(even)) {
  background: #f9f9f9;
}

.message-row.ai::before,
.message.ai::before {
  display: none !important;
  content: none !important;
}
.message-row.ai,
.message.ai {
  padding-left: 0 !important;
  margin-left: 0 !important;
}

:deep(.n-base-selection) {
  border: none !important;
  box-shadow: none !important;
  background: none !important;
  padding: 0 !important;
  min-width: unset !important;
  width: auto !important;
}
:deep(.n-base-selection .n-base-selection-label span),
:deep(.n-base-selection .n-base-selection-label) * {
  color: #2080f0 !important;
}
:deep(.n-base-selection .n-base-selection__arrow) {
  display: none !important;
}
:deep(.n-base-selection .n-base-selection__border) {
  display: none !important;
}
:deep(.n-base-selection .n-base-selection__state-border) {
  display: none !important;
}
:deep(.n-base-selection .n-base-selection__placeholder) {
  color: #2080f0 !important;
  font-weight: normal !important;
}
:deep(.n-base-selection:hover) {
  border: none !important;
  box-shadow: none !important;
  background: none !important;
}

.ai-text {
  padding-left: 12px;
  background: none;
  box-shadow: none;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
  word-break: break-all;
  white-space: pre-wrap;
}

.message-row.ai::before,
.message.ai::before {
  display: none !important;
  content: none !important;
}
.message-row.ai,
.message.ai {
  padding-left: 0 !important;
  margin-left: 0 !important;
}

.custom-popover .n-popover__content {
  background: #fff !important;
  color: #888 !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08) !important;
  font-size: 12px;
  padding: 6px 14px;
  min-width: 60px;
  text-align: center;
}

.ai-thinking-bubble {
  background: #fffbe6;
  color: #b8860b;
  border: 1px solid #ffe58f;
  border-radius: 10px;
  padding: 10px 18px;
  margin-bottom: 8px;
  font-size: 0.98em;
  box-shadow: 0 1px 4px rgba(255, 215, 0, 0.08);
  cursor: pointer;
}
.ai-thinking-collapsed {
  background: #fffbe6;
  color: #b8860b;
  border: 1px dashed #ffe58f;
  border-radius: 10px;
  padding: 6px 16px;
  margin-bottom: 8px;
  font-size: 0.98em;
  text-align: center;
  cursor: pointer;
}

.user-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: 100%;
  /* 新增，确保用户气泡紧贴右侧 */
  margin-right: 0;
  padding-right: 0;
}
.user-name-outer {
  color: #0a5d36;
  font-weight: bold;
  font-size: 1.08em;
  margin-bottom: 2px;
  margin-right: 12px;
  margin-top: 2px;
  text-align: right;
  letter-spacing: 0.5px;
}
.user-image {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}
.user-image img {
  max-width: 120px;
  max-height: 80px;
  border-radius: 8px;
  object-fit: cover;
}
.image-preview-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 12px 18px;
  background: #fafafa;
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
}
.image-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}
.image-preview-item {
  position: relative;
  width: 120px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.image-remove-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}
.image-count-tip {
  margin-top: 8px;
  color: #666;
  font-size: 12px;
  font-weight: 500;
}

/* 文档预览区域样式 */
.document-preview-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 12px 18px;
  background: #fafafa;
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
}

/* 欢迎消息样式 */
.welcome-text {
  color: #999;
  text-align: center;
  font-size: 16px;
  margin: 0;
  padding: 20px;
}

/* 空状态容器样式 */
.empty-state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  flex: 1;
}

.document-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.document-preview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.document-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.document-name {
  font-size: 14px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.document-remove-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #999;
  transition: all 0.2s;
}

.document-remove-btn:hover {
  background-color: rgba(0, 0, 0, 0.1);
  color: #333;
}

.document-count-tip {
  margin-top: 8px;
  color: #666;
  font-size: 12px;
  font-weight: 500;
}